/**
 * BookingServiceImpl.java
 * 16.08.2010
 */
package org.example.booking;

import java.math.BigDecimal;
import java.util.Random;

import javax.jws.WebService;

/**
 * <p>
 * </p>
 * @author tserge
 * @since 16.08.2010
 */
@WebService(endpointInterface = "org.example.booking.BookingService",
  serviceName = "OrderBookingService",
  portName = "OrderBooking",
  targetNamespace = "http://example.org/booking/order")
public class BookingServiceImpl
  implements BookingService
{

  private static final int MAX_PRICE = 500;
  private static final int MAX_ROOM = 1000;

  private final Random randomPrice = new Random();
  private final Random randomRoom = new Random();

  @Override
  public Order bookOrder( final Order order )
  {
    order.setRoomPrice( BigDecimal.valueOf( randomPrice.nextInt( MAX_PRICE ) ) );
    order.setRoom( "Room " + randomRoom.nextInt( MAX_ROOM ) );
    System.out.println( "BookingServiceImpl.bookOrder() : " + order );
    return order;
  }

}
